﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProductManagement.Infrstructre
{
    /// <summary>
    /// 产品类型仓储接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IProductsTypeRepository<T> where T : class, new()
    {
        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <returns></returns>
        Task<ISugarQueryable<T>> GetAll();

        /// <summary>
        /// 没有异步获取所有数据
        /// </summary>
        /// <returns></returns>
        List<T> Query();

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T entity);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);

        /// <summary>
        /// 批量真删除
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> DelRange(List<T> entities);
    }
}
